home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-05
/
ipload.zip
/
BAPICHK.ASM
< prev
next >
Wrap
Assembly Source File
|
1991-03-01
|
5KB
|
163 lines
; BAPICHK.ASM
;
; 02-28-91 Michael McNeil
;<<<<<<<<<<
PAGE 92, 132
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;
; Copyright 3Com Corporation, Santa Clara, California 1991
;
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;---------------------------------------------------------
; Check presence of BAPI
;
; by Michael McNeil
; 3Com Corporation
;---------------------------------------------------------
START_OFF equ 0100h ; origin offset for .COM files
; ASCII characters
;
NUL equ 0 ; ASCII: NUL char
LF equ 0Ah ; ASCII: LF char
CR equ 0Dh ; ASCII: CR char
; DOS function calls
;
DOS_INT equ 021h ; interrupt to call DOS functions
DOS_PRINT$ equ 09h ; DOS function: print string up to '$'
DOS_EXIT equ 04Ch ; DOS function: exit process with errorlevel
; BAPI function calls
;
BAPI_INT equ 014h ; interrupt to communicate with BAPI
BAPI_CONNECT equ 0A0h ; function: connect to a port name
BAPI_DISCON equ 0A1h ; function: disconnect
BAPI_WRITEC equ 0A2h ; function: write a character
BAPI_READC equ 0A3h ; function: read a character
BAPI_WRITEB equ 0A4h ; function: write a block of characters
BAPI_READB equ 0A5h ; function: read a block of characters
BAPI_BREAK equ 0A6h ; function: send break
BAPI_STATUS equ 0A7h ; function: read status
BAPI_GET_X3 equ 0A8h ; function: read X.3 parameters
BAPI_SET_X3 equ 0A9h ; function: set X.3 parameters
BAPI_VER equ 0AFh ; function: interface version
BAPI_EN_ECM equ 0B0h ; function: enable/disable ECM
BAPI_ECM equ 0B1h ; function: Enter Command Mode
BAPI_GET_ECM equ 0B2h ; function: get ECM watch state
BAPI_MAGIC equ 0AAAAh ; magic number for version check
ERROR_BAPI equ 0F0h ; errorlevel to indicate error from bapi call
code segment para public
assume cs: code, ds: code
;%---------------------------------------------------------------------- begin
;
; origin of program execution
;
;-%---------------------------------------------------------------------
org START_OFF ; origin for .COM file
public begin
begin proc near
jmp main ; jump to main routine
begin endp
;%---------------------------------------------------------------------- data
;
; miscellaneous variables (permanent)
;
;-%---------------------------------------------------------------------
;%------------------------------------------------------------------- bapichk
;
; Do the work of the program
;
; DS register is unchanged
; other registers are not preserved
;
;-%------------------------------------------------------------------
public bapichk
bapichk proc near
clc ; start off with carry clear
mov bx, BAPI_MAGIC
mov ax, BAPI_VER * 0100h + 0h ; BAPI version check function
int BAPI_INT ; call BAPI interrupt
jc failure ; if no error during call
dec al ; decrement version no. to zero
; clc ; show successful completion
; jmp return
; return to caller
;
return:
ret
; error handler
;
failure:
mov dx, offset failed_msg ; failed message
mov ah, DOS_PRINT$ ; print string function
int DOS_INT ; call DOS function interrupt
stc ; indicate operation failed
jmp short return
bapichk endp
;%---------------------------------------------------------------------- main
;
; main routine
;
;-%---------------------------------------------------------------------
public main
main proc near
; cld ; clear default direction
call bapichk ; call get bapi version subr.
jnc no_error ; if an error occurred
mov ax, DOS_EXIT * 0100h + ERROR_BAPI ; exit with errorlevel
int DOS_INT ; (doesn't return...)
; if all has gone well...
;
no_error:
mov ah, DOS_EXIT ; exit with no errorlevel
int DOS_INT ; (doesn't return...)
main endp
;%---------------------------------------------------------------------- ddata
;
; disposable data (discarded at termination)
;
;-%---------------------------------------------------------------------
public failed_msg
public copy_right
public banner_msg
public ver_ident
public version_no
failed_msg db '*** BAPICHK: can''t check BAPI version'
db CR, LF, '$', NUL
copy_right db 'Copyright (C) 3Com Corporation 1991', NUL
banner_msg db '3Com Check BAPI Presence, Version '
ver_ident db '%VER '
version_no db '1.0', NUL, 'a', NUL
code ends
end begin